package com.example.demomultidatasurcejdbk.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class JdbcTemplateConfig {
    @Bean
    public JdbcTemplate primaryJdbcTemplate(
            @Qualifier("primaryDataSource")DataSource primaryDataSource){
                return new JdbcTemplate(primaryDataSource);
    }

    @Bean
    public JdbcTemplate secondaryJdbcTemplate(
            @Qualifier("secondaryDataSource")DataSource secondaryDataSource){
        return new JdbcTemplate(secondaryDataSource);
    }


}
